<!--用户信息（头像和个性签名）-->
<script setup lang="ts">
import {defineEmits, ref} from "vue";

const emit = defineEmits(['change'])
let activeKey = ref<string>('Session')
const change = (key: string) => {
  activeKey.value = key
  emit('change', key)
}
</script>
<template>
  <div class="user-info">
    <div class="left-info">
      <div class="avatar">
        <img src="@/assets/image/avatar.jpg">
      </div>
    </div>
    <div class="right-info">
      <div class="nickname">Soraki</div>
      <div class="status">dss</div>
    </div>
  </div>
  <div class="control">
    <div class="control-item " @click="change('Session')">
      <div :class="{'control-item-icon':true,'active1':activeKey === 'Session'}">
        <span class="material-icons" style="color: #2F71F2">chat</span>
      </div>
    </div>
    <div class="control-item" @click="change('Contacts')">
      <div :class="{'control-item-icon':true,'active2':activeKey === 'Contacts'}">
        <span class="material-icons" style="color: #26B383">group</span>
      </div>
    </div>
    <div class="control-item" @click="change('Func')">
      <div :class="{'control-item-icon':true,'active3':activeKey === 'Func'}">
        <span class="material-icons" style="color: #FE9F1A">grid_view</span>
      </div>
    </div>
  </div>
</template>
<style lang="less" scoped>
.user-info {
  width: 240px;
  height: 70px;
  display: flex;
  align-items: center;

  .left-info {

    width: 70px;
    height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;

    .avatar {
      cursor: pointer;
      width: 50px;
      height: 50px;
      border-radius: 50%;
      overflow: hidden;
      box-sizing: content-box;

      img {
        width: 50px;
        height: 50px;
      }
    }

    .avatar:hover {
      border: 2px solid #2F71F2;

      img:hover {
        opacity: 0.8;
      }
    }

    .avatar:active {
      border: 1px solid #2F71F2;

      img:hover {
        opacity: 1;
      }
    }
  }

  .right-info {
    height: 70px;
    width: 170px;
    padding: 8px 8px 8px 0;

    .nickname {
      font-size: 18px;
      font-weight: 600;
    }

    .status {
      color: #8A8F99;
      font-size: 12px;
    }
  }
}

.control {
  width: 240px;
  height: 60px;
  display: flex;
  justify-content: space-around;

  .control-item {
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;

    .control-item-icon {
      width: 70px;
      height: 45px;
      user-select: none;
      text-align: center;
      cursor: pointer;
      border-radius: 10px;

      .material-icons {
        font-size: 35px;
        height: 45px;
        line-height: 45px;
      }
    }

    .active1 {
      background-color: #D1E8FF;
    }

    .active2 {
      background-color: #D3FAE7;
    }

    .active3 {
      background-color: #FFEFD1;
    }

  }
}
</style>
